<%@ include file="/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<head>
<script type="text/javascript" src="${ctx}/scripts/jquery-1.7.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jquery-datepicker.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jquery-ui-1.8.16.custom.min.js"></script>
<link href="${ctx}/css/pagination.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/jquery-ui-1.8.16.custom.css" />
<script>
		$(function() {
		$('#createTimeId').datepicker({ changeYear: true,changeMonth:true,yearRange: 'c-60:c+20'});
		});
</script>
<script>
	function check(){
		var branchName = document.getElementById("branchNameId");
		var branchSecretaryName = document.getElementById("branchSecretaryNameId");
		var createTime = document.getElementById("createTimeId").value;
		var canSubmit = document.getElementById("canSubmit").value;
		if(branchName.value.replace(/(^\s*)/g, "")=="") {
			alert("组织名称不能为空！");
			branchName.focus();
			return false;
		}
		if(canSubmit=="false"){
			alert("组织名称已存在，请修改！");
			document.getElementById("branchNameId").focus();
			return false;
		}
		if(branchSecretaryName.value.replace(/(^\s*)/g, "")==""){
			alert("书记不能为空！");
			branchSecretaryName.focus();
			return false;
		}
		if(createTime==null||createTime==""){
			alert("成立时间不能为空！");
			return false;
		}
	}
</script>
<script type="text/javascript">
    var xmlHttp;
	function checkBranchName(){
		value = document.getElementById("branchNameId").value;
		if(value==null||value==""){
			return false;
		}else{
			var uri = "Admin_MyBranchAction_checkBranchName?branchName=" + encodeURI(value);
			if (window.XMLHttpRequest) {
				xmlHttp = new XMLHttpRequest();
			} else {
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {
						alert("不能创建XMLHttpRequest对象!!!");
						return;
					}
				}
			}
			xmlHttp.open("post", uri, true);
			xmlHttp.onreadystatechange = handleResponse;
			xmlHttp.send(null);
		}	
	}
		
	function handleResponse() {
			if (xmlHttp.readyState == 4) {
				if (xmlHttp.status == 200) {
					var result = xmlHttp.responseText;
					if(result=="exist"){
						document.getElementById("result").innerHTML="党组织已存在";
						document.getElementById("canSubmit").value=false;
					}else{
						document.getElementById("result").innerHTML="";
						document.getElementById("canSubmit").value=true;
					}
					}
				}
			}
</script>
<title>北京邮电大学学生党员在线学习中心</title>
</head>
<div id="nav_bar">
    <img id="nav_bar_left" src="../../../styles/nav_bar_left.png" alt=""/>
    <div id="welcome_label">欢迎您，&nbsp;<s:property value="#session.session_user.adminName" />!</div>
    <img id="nav_bar_seperator" src="../../../styles/nav_bar_seperator.png" alt=""/>
    <div id="nav_location">
        <img id="nav_bar_point" src="../../../styles/nav_bar_point.png" alt="" />
        <div id="nav_cur_location">当前位置：&nbsp;<a href="${ctx}/Admin_branchManageAction_manageBranch">党组织管理</a>&nbsp;&nbsp;>&nbsp;&nbsp;<span style="color:black;">新增党组织</span></div>
    </div>
    <img style="float:right; width:5px;" src="../../../styles/nav_bar_right.png" alt=""/>
    <a id="nav_logout" href="${ctx}/logoutAction_adminLogout">[安全退出]</a>
</div>
<div style="clear:both; height:5px;">&nbsp;</div>

<div style="min-height:450px;">
	<div id="side_menu" style="min-height:550px;">
	    <div id="side_menu_title">
	        <img src="../../../styles/side_menu_title_img.png" alt="" />
	        <span>党组织管理</span>
	    </div>
	    <div id="side_menu_title_bottom">&nbsp;</div>
	    <div class="side_sub_menu">
	        <div class="side_menu_point">&nbsp;</div>
	        <a href="${ctx}/Admin_MyBranchAction_branchList">党组织维护</a>
	    </div>
	     <s:if test="#session.level == 2 || #session.level == 3">
	    <div class="side_menu_seperator">&nbsp;</div>
	    <div class="side_sub_menu_focus">
	        <div class="side_menu_point">&nbsp;</div>
	        <a href="${ctx}/Admin_MyBranchAction_addBranch">新增党组织</a>
	    </div>
	    </s:if>
	    <div class="side_menu_seperator">&nbsp;</div>
	    <div class="side_sub_menu">
	        <div class="side_menu_point">&nbsp;</div>
	        <a href="${ctx }/Admin_MyBranchAction_manageBranchNotice">支部公告管理</a>
	    </div>
	    <div class="side_menu_seperator">&nbsp;</div>
	    <div class="side_sub_menu">
	        <div class="side_menu_point">&nbsp;</div>
	        <a href="${ctx }/Admin_MyBranchAction_manageBranchActivity">支部活动管理</a>
	    </div>
	</div>
	
	<div id="main_content">
	    <div id="main_content_title">
	        <img src="../../../styles/content_title_img.png" alt="" />
	        <span>新增党组织</span>
	    </div>
	    <div class="main_content_title_bottom">&nbsp;</div>
		<s:form action="Admin_MyBranchAction_addRealBranch" method ="post" theme="simple" enctype="multipart/form-data" onsubmit="return check();">
			<input type="hidden" id = "canSubmit" value='false' />
				<table class="page_table">
		
					<tr >
						<td class="leftTD">组织名称:</td>
						<td class="rightTD"><input id="branchNameId" type="text" value="" name="branchName" onblur="checkBranchName();" maxlength="60"><font color=red>*</font><span id="result"></span></td>
						<td class="leftTD">上级党委：</td>
						<td class="rightTD">
						<s:select id="firstPa"
								list="firstPaList" listKey="id" listValue="branchName"
								name="firstPa"  />
						</td>
					</tr>
					<tr >
						
						<td class="leftTD2">书记:</td>
						<td class="rightTD"><input id="branchSecretaryNameId" type="text" value="" name="branchSecretaryName" maxlength="60"><font color=red>*</font></td>
						<td class="leftTD2">成立时间:</td>
						<td class="rightTD"><input id= "createTimeId" type="text" value="" name= "createTime" readonly="true"/><font color=red>*</font></td>
		
					</tr>
		
					<tr >
						<td class="leftTD">副书记:</td>
						<td class="rightTD"><input id="branchViceSecretaryNameId" type="text" value="" name="branchViceSecretaryName" maxlength="60"></td>
						<td class="leftTD">组织委员:</td>
						<td class="rightTD"><input type="text" value="" name="organizationName" maxlength="60"/></td>
						
		
		
					</tr>
					<tr >
						<td class="leftTD2">宣传委员:</td>
						<td class="rightTD"><input type="text" value="" name="publicityName" maxlength="60"/></td>
						<td class="leftTD2">纪检委员:</td>
						<td class="rightTD"><input type="text" value="" name="disciplineName" maxlength="60"/></td>
						
		
		
					</tr>
					<tr >
						<td class="leftTD">青年委员:</td>
						<td class="rightTD"><input type="text" value="" name="youthName" maxlength="60"/></td>
						<td class="leftTD">保密委员:</td>
						<td class="rightTD"><input type="text" value="" name="confidentialityName" maxlength="60"/></td>
						
		
		
					</tr>
		
					<tr >
						<td class="leftTD2">群众委员:</td>
						<td class="rightTD"><input type="text" value="" name="massesName" maxlength="60"/></td>
						<td class="leftTD2">统战委员:</td>
						<td class="rightTD"><input type="text" value="" name="unitedName" maxlength="60"/></td>
		
		
		
					</tr>
					<tr >
						<td class="leftTD">荣誉:</td>
						<td colspan=3 class="rightTD"><textarea rows="2" cols="60" name="branchHonor"></textarea></td>
					</tr>
					<tr >
						<td class="leftTD2">简介:</td>
						<td colspan=3 class="rightTD"><textarea rows="6" cols="60" name="branchSummary"></textarea></td>
					</tr>
		
					<tr >
						<td class="leftTD">上传照片:</td>
						<td colspan="3" class="rightTD"><s:file name="branchPic" /></td>
		
					</tr>
		
		
				</table>
		
				<br />
				<div align="center">
					<input type="submit" name="button" id="button" class="input-button" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="history" name="history" type="button" class="input-button" value="返回" onclick="window.location.href='javascript:history.go(-1);'"/>
		
				</div>
		</s:form>
		</div>
		<div style="clear:both">&nbsp;</div>
</div>





